Dynomotion

Group: DynoMotion Message: 12824 From: Moray Cuthill Date: 2/22/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
The obvious issue is you've commented out the two lines that enable the KStep -

/*
// Will enable amplifiers by mechanical switch and Relay 0
      SetBitDirection(45,1);  // set Enable Signal as Output
      SetBit(45);        // Enable the amplifiers
*/

If Bit 45 isn't configured as an output and enabled, the KStep won't move anything.

I can't comment on why the printf isn't showing though.

Moray

On Mon, Feb 22, 2016 at 9:22 PM, d.triezenberg@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from d.triezenberg@... [DynoMotion] included below]

Tom,

Following your message yesterday, I changed the limit switch options parameter from 0x123 to 0x12f (for all 3 axes), and all was then functional, Kmotion and KmotionCNC.
You said that the Console screen should have been giving messages that the axes were disabled.  I have been watching the Console screen all along, but saw no such messages.  I cannot say about the Axis screen, since I was not monitoring it.
Today I have apparently done something unintended, as the 3 axes are once again not moving.  I am getting no Console messages indicating problems.  The Axis Screen shows that all 3 axes are enabled.  I have attached my init.c file.  At the time that I lost motion, I was attempting to change ch1->OutputGain from 1 to -1 so that moves (by console script command or by KmotionCNC) would go the right direction.
I am thinking that I do not see all Console messages. When I power up, there is a date and time stamped message (Kmotion program started).  When I send a script command, it is echoed back, along with "KFLOP  4.33" and "Ready".  But, my init.c file contains a printf() message, and I do not see that argument string, either from power up or when I run init.c from the C Program screen.
I also question if things are working correctly when I am using the C Program screen.  On Compile, I always get a message declaring No Errors, plus some text/bss/data statistics.  But there is no message when I click Download or Run, leaving me to wonder whether anything has happened.  That the Console screen does not show my printf() string is additional unsettling evidence.
Please advise if you see something amiss in the init.c file.  I have been enabling the axes by the KFLOP J6 pin (+3.3v) rather than by bit 45.
Dave


---In DynoMotion@yahoogroups.com, <tk@...> wrote :

Hi Dave,

You seem to have some typo errors in your email.  Please attach your init.c program so we can see exactly what it is.

It seems your limit switches cause the input to go low (unchecked) when triggered.  So you should use the "Stop when low" option.  Which would (if you aren't using KMotion to generate the code for you) is:
    ch0->LimitSwitchOptions=0x12f;

Otherwise all your axes will be always disabled due to Limit Switch conditions.  If this is the case it should be obvious because disable messages will appear on the Console Screen and the Axis Screen will show all the Axes not enabled.

InvDistPerCycle has no effect on Step Pulse and Direction Drives such as KStep.

16 motor step pulses generate one full step with KStep.  So with a standard 200 full step/rev stepper motor there are 3200 "steps" per revolution.

Regards
TK



On 2/21/2016 2:14 PM, d.triezenberg@... [DynoMotion] wrote:
 

I have been closely following the procedure in the KSTEP Basics Tutorial in order to bring up my 3 axis engraving mill, which uses open loop steppers.  The Step Response screen works correctly (i.e., the motor for the selected axis will move and then return). So I have adjusted V,A,J and created an init.c file that includes the statement

DefineCoordSystem(0,1,2,-1)

The problem is that when I start up KmotionCNC, I cannot jog any of the 3 axes; they do not move when the buttons are clicked. So I am not ready to proceed with G code.

In an effort to debug, I can go back to Kmotion and find that the Step Response screen no longer works.  I can only make it work again by cycling power to KFLOP/KSTEP and NOT running my init.c file.  The same behavior occurs with the Console screen; a MoveRel script command works only if I have NOT run the init.c file.

By trial and error, I find that the statement that has seized all axis motion is the DefineCoordSystem() statement.  If I remove it from init.c, then I can run the Step Response moves, and MoveRel on the Console. This is entirely unexpected; I thought the DefineCoordSystem() was just providing some information needed by KmotionCNC.

Question 1) What is it that I do not understand?

Additional information:

I am running software version 4.33, but my USB driver is from 4.34 (signed). 

I have wired 6 microswitches as NC limit switches, and the relevant statements in init.c are

ch0->LimitSwitchOptions = 0x123;

ch0->LimitSwitchNegBit = 169;

ch0-LimitSwitchPosBit = 168;

and similar for ch1 and ch2 (170,171,172,173).

 I have wired the switches (through a simple breakout board) to pins 9-14 of KSTEP J36. 24 volt power is on pin 8 and all switches complete a circuit to 24 volt return. The Digital I/O screen of Kmotion (KSTEP Tab) shows that one of these opto inputs will transition from checked (high?) to unchecked (low?) when I manually depress a switch. 

I have two related questions on the size of steps.  My motors are 200 steps/rev. I find that 3200 "counts" on the Step Response screen causes one full revolution of the motor.  This seems to be independent of the value assigned to chX->InvDistPerCycle in the init.c file.  I also get one full revolution from the script statement

MoveRel0 = 3200

Question 2) Does parameter chX->InvDistPerCycle have any effect on the functioning of Kmotion screens?

Question 3) Do I correctly infer that 16 "counts" are one full revolution?

Dave




Group: DynoMotion Message: 12826 From: d_triezenberg Date: 2/22/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
Moray,
Yes, I commented out the bit 45 set because I am using a hardware enable through J6 on KSTEP.  It does work, else I would not have had the motors running yesterday and this morning. And, I can hear magnetic noise from the motors when the drives are enabled.
Dave

Group: DynoMotion Message: 12828 From: Tom Kerekes Date: 2/22/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
Hi Dave,

You must terminate all printf statements with a new line character for the line to be output.

change

    printf("Program init.c has run.");

to

    printf("Program init.c has run.\n");


Regarding the C Program the only operation that shows a message is the Compile.  In your case you should only be using the button with all the arrows (Save/Compile/Download/Run).  The individual operation buttons are probably of no use to you and need to used in the order that makes logical sense.

If you are forcing the KStep Enable to 3.3V that is ok and should enable KStep but take care not to also configure the KFLOP bit 45 as an output as that is directly connected to the KStep Enable and you would therefore connect two outputs together. 

I can't see a reason your motors aren't moving.  Do the Destinations on the Axis Screen Change when you command a move?

Regards
TK


On 2/22/2016 1:22 PM, d.triezenberg@... [DynoMotion] wrote:
 

Tom,

Following your message yesterday, I changed the limit switch options parameter from 0x123 to 0x12f (for all 3 axes), and all was then functional, Kmotion and KmotionCNC.
You said that the Console screen should have been giving messages that the axes were disabled.  I have been watching the Console screen all along, but saw no such messages.  I cannot say about the Axis screen, since I was not monitoring it.
Today I have apparently done something unintended, as the 3 axes are once again not moving.  I am getting no Console messages indicating problems.  The Axis Screen shows that all 3 axes are enabled.  I have attached my init.c file.  At the time that I lost motion, I was attempting to change ch1->OutputGain from 1 to -1 so that moves (by console script command or by KmotionCNC) would go the right direction.
I am thinking that I do not see all Console messages. When I power up, there is a date and time stamped message (Kmotion program started).  When I send a script command, it is echoed back, along with "KFLOP  4.33" and "Ready".  But, my init.c file contains a printf() message, and I do not see that argument string, either from power up or when I run init.c from the C Program screen.
I also question if things are working correctly when I am using the C Program screen.  On Compile, I always get a message declaring No Errors, plus some text/bss/data statistics.  But there is no message when I click Download or Run, leaving me to wonder whether anything has happened.  That the Console screen does not show my printf() string is additional unsettling evidence.
Please advise if you see something amiss in the init.c file.  I have been enabling the axes by the KFLOP J6 pin (+3.3v) rather than by bit 45.
Dave


---In DynoMotion@yahoogroups.com, <tk@...> wrote :

Hi Dave,

You seem to have some typo errors in your email.  Please attach your init.c program so we can see exactly what it is.

It seems your limit switches cause the input to go low (unchecked) when triggered.  So you should use the "Stop when low" option.  Which would (if you aren't using KMotion to generate the code for you) is:
    ch0->LimitSwitchOptions=0x12f;

Otherwise all your axes will be always disabled due to Limit Switch conditions.  If this is the case it should be obvious because disable messages will appear on the Console Screen and the Axis Screen will show all the Axes not enabled.

InvDistPerCycle has no effect on Step Pulse and Direction Drives such as KStep.

16 motor step pulses generate one full step with KStep.  So with a standard 200 full step/rev stepper motor there are 3200 "steps" per revolution.

Regards
TK



On 2/21/2016 2:14 PM, d.triezenberg@... [DynoMotion] wrote:
 

I have been closely following the procedure in the KSTEP Basics Tutorial in order to bring up my 3 axis engraving mill, which uses open loop steppers.  The Step Response screen works correctly (i.e., the motor for the selected axis will move and then return). So I have adjusted V,A,J and created an init.c file that includes the statement

DefineCoordSystem(0,1,2,-1)

The problem is that when I start up KmotionCNC, I cannot jog any of the 3 axes; they do not move when the buttons are clicked. So I am not ready to proceed with G code.

In an effort to debug, I can go back to Kmotion and find that the Step Response screen no longer works.  I can only make it work again by cycling power to KFLOP/KSTEP and NOT running my init.c file.  The same behavior occurs with the Console screen; a MoveRel script command works only if I have NOT run the init.c file.

By trial and error, I find that the statement that has seized all axis motion is the DefineCoordSystem() statement.  If I remove it from init.c, then I can run the Step Response moves, and MoveRel on the Console. This is entirely unexpected; I thought the DefineCoordSystem() was just providing some information needed by KmotionCNC.

Question 1) What is it that I do not understand?

Additional information:

I am running software version 4.33, but my USB driver is from 4.34 (signed). 

I have wired 6 microswitches as NC limit switches, and the relevant statements in init.c are

ch0->LimitSwitchOptions = 0x123;

ch0->LimitSwitchNegBit = 169;

ch0-LimitSwitchPosBit = 168;

and similar for ch1 and ch2 (170,171,172,173).

 I have wired the switches (through a simple breakout board) to pins 9-14 of KSTEP J36. 24 volt power is on pin 8 and all switches complete a circuit to 24 volt return. The Digital I/O screen of Kmotion (KSTEP Tab) shows that one of these opto inputs will transition from checked (high?) to unchecked (low?) when I manually depress a switch. 

I have two related questions on the size of steps.  My motors are 200 steps/rev. I find that 3200 "counts" on the Step Response screen causes one full revolution of the motor.  This seems to be independent of the value assigned to chX->InvDistPerCycle in the init.c file.  I also get one full revolution from the script statement

MoveRel0 = 3200

Question 2) Does parameter chX->InvDistPerCycle have any effect on the functioning of Kmotion screens?

Question 3) Do I correctly infer that 16 "counts" are one full revolution?

Dave




Group: DynoMotion Message: 12829 From: d_triezenberg Date: 2/22/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
Tom,
The addition of a newline character to the printf() argument string has the desired effect, the message now prints to the console.  It has been some years since I regularly programmed C.
Agreed about I/O bit 45, it remains an input.  The Digital I/O screen shows it going high and low in response to my "Enable" toggle switch.
On the Axis screen, both Dest and Position show as zero for all 3 axes.  When I send the script command "MoveRel1=3200", there is no change in this display, not even a momentary flicker.  The 3 axes are indicated as enabled.
Thanks for your attention,
Dave
Group: DynoMotion Message: 12841 From: Tom Kerekes Date: 2/23/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
Hi Dave,

I didn't realize you were flashing User Programs and Data. Please do not do this. To remove all User Programs and to restore all settings to default re-Flash "New Version" using the KMotion Config/Flash Screen. 

I doubt if re-installing the KMotion Software would change anything. 

The new V4.34 signed USB Drivers can be used with KMotion V4.33. 

Another potential source of confusion is that KFLOP needs to be informed that a KStep is present by executing KStepPresent=TRUE; in a C Program otherwise the inputs (your Limit Switches) will not update or be valid. 

Please retest my previous sequence starting from a default state. 

Regards
TK

On Feb 23, 2016, at 4:41 AM, d.triezenberg@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

Tom, 
I followed your steps. All was OK until step 9; Dest did not change and the motor did not move.
I then proceeded as follows:
1. At C Program window, create a 1 line "Hello, World" program. Compile, Download, Run with the one button.
2. Flash this new program into thread 1, so that init.c will not run at power-up.
3. Close Kmotion, power down KFLOP/KSTEP.
4. Restart Kmotion, open windows Console, Axis, C Program
5. (C Program window) Open init.c
6. Power up KFLOP/KSTEP, wait until connected
7. (Config & Flash window) Import All from Open C Program
8. (Digital I/O window) set bit 0 as output and state as "checked" - I need this for the hardware enable signal at KSTEP J6.  Now I can hear that the motors have power.
9. (Step Response window, chan 0) click Move. Motor indexes back & forth, changing Dest shows in Axis window.
10. (Console window) Send "MoveRel0=3200".  Motor makes a full revolution and Dest changes to 3200
11. (C Program window) Compile, Download, Run init.c using the one button
12. (Step Response window) click Move. No response from motor or Dest in Axis window.
13. (Console window) Send "MoveRel0=3200". No motor response, no change to Dest
I am at at a loss to explain the result of steps 12 & 13.  I have attached a new copy of init.c to this message; I have been editing it some and could have inadvertantly changed something.
At this point, I am thinking that it is time to uninstall the Kmotion software and then reinstall.  Is it OK to use the 4.34 (signed?) USB driver with version 4.33?
Dave

Group: DynoMotion Message: 12842 From: d_triezenberg Date: 2/23/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
Tom,
Having read pp 32-33 of the KFLOP user's manual, I came to the apparently erroneous conclusion that init.c would be a good program to "Launch on Power Up".
So I went through the New Version flash process. The file DSPKFLOP.out was involved, with time stamp 12/1/2015 6:05 pm.
Then going through your 9 steps again, I got the same result: no motor motion and no Dest change.
It doesn't appear to me that a hardware failure is involved here, since I am still able to make the motor move if init.c is NOT executed (ref. my 13 step procedure, but w/o flashing).
Dave
Group: DynoMotion Message: 12844 From: d_triezenberg Date: 2/23/2016
Subject: Re: Unexpected behavior of C function DefineCoordSystem() [1 Attachm
Tom,
A bit more info on this puzzling situation:
I find that if I launch KmotionCNC (after a power down state of KFLOP) and push the init button (which is set up to run my init.c program), then I can jog the X and Y axes. Z does not jog, but the Z display increments.
Then if I launch Kmotion also, and NOT run init.c, I get motor motion from Console Script commands for X & Y (0 & 1).  Again, no Z motor motion, but Dest on the Axis window changes.
If I then run init.c from the C Program window, the motors no longer react to Console Script move commands.
Dave